﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CopyTransform : MonoBehaviour
{
    public GameObject father;
    public bool pos;
    public bool rot;
    public bool sca;

    public Vector3 stPos;

    private void Awake()
    {
        if (father == null) Debug.LogError(gameObject + "组件未赋值");
        if (!pos && !rot && !sca) Debug.LogError(gameObject + "组件无效");

        stPos = transform.position;
    }

    private void Update()
    {
        if (pos) transform.position = father.transform.position + stPos;
        if (rot) transform.rotation = father.transform.rotation;
        if (sca) transform.localScale = father.transform.lossyScale;
    }
}
